<!DOCTYPE html>
<html>
<head>
    <title>情趣酒店</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css"/>
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/strategyCatalogs.css"/>
    <link rel="stylesheet" href="/js/plugins/dialog/dialog.css"/>
    <script src="/js/plugins/jrender/jrender.js"></script>
    <script src="/js/plugins/jquery-confirm/js/jquery-confirm.js"></script>
    <script src="/js/plugins/dialog/dialog.min.js"></script>
    <script src="/js/common.js"></script>
    <script>

        $(function () {
            var id = getParams().hotelId;
            var user = JSON.parse(sessionStorage.getItem("user"));

            //点击评论跳转到攻略评论页面
            $("#commentBtn").click(function () {
                if (user) {
                    window.location.href = "/addHotelComment.html?hotelId=" + id;
                } else {
                    $(document).dialog({
                        type: "confirm",
                        style: "IOS",
                        titleShow: false,
                        content: "请先登录再评论",
                        onClickConfirmBtn: function () {
                            location.href = "/login.html";
                        }
                    });
                }
            })
            //console.log(id);
            //发送ajax请求根据酒店的id获取该酒店的房型
            $.get("/hotels/detail/" + id, function (data) {
                //console.log(data);
                $(".hotelClass").renderValues({list: data});

            });
            //发送ajax请求,获取酒店详情
            $.get("/hotels/" + id, function (data) {
                //console.log(data);
                $("#strategies").renderValues({list: data});
            });
            //发送ajax请求,获取酒店评论
            $.get("/hotels/comments/" + id, function (data) {
                //console.log(data);
                $("#comment").renderValues({list: data});


                //星星
                $.each(data, function (index, value) {
                    console.log(arguments);
                    //显示星星评价
                    var starhtml = "";
                    for (var i = 0; i < value.starNum; i++) {
                        starhtml += '<i class="fa fa-star"></i>';
                    }
                    for (var i = value.starNum; i < 5; i++) {
                        starhtml += '<i class="fa fa-star-o"></i>';
                    }
                    $(".comment-star[data-starid ='" + value.id + "']").html(starhtml);
                    $(".icon[data-commentid ='" + value.id + "']").attr("href", "strategyDetails.html?id=" + value.id);
                    //显示评论的图片,拼接方式
                    var imgshtml = "";
                    $("#0" + value.id).html(imgshtml);
                });
            });


        });
    </script>
</head>

<body>
<div class="search-head">
    <div class="row nav-search">
        <div class="col-2">
            <a href="javascript:history.go(-1);">
                <span><i class="fa fa-chevron-left fa-2x"></i></span>
            </a>
        </div>
        <div class="col-10">
            <div class="input-group-sm search">
            </div>
        </div>
    </div>
</div>
<div id="strategies">
    <div class="container strategies">
        <div>
            <img width="350px" height="200px" render-src="list.coverUrl"/>
        </div>

        <h3 class="title" id="title list-name" render-html="list.name"></h3>
        <h5 id="list-typeName" render-html="list.typeName"></h5>

        <div class="focus">
            <div>
                <div render-html="list.location"></div>
            </div>
        </div>
    </div>
</div>


<ul class="nav nav-pills nav-justified border border-left-0 border-top-0 border-right-0" id="pills-tab">
    <li class="nav-item ">
        <a class="nav-link active" id="pills-catalog-tab" data-toggle="pill" href="#pills-catalog">
            <span>订房详情</span>
        </a>
    </li>
    <li class="nav-item">
        <a class="nav-link " id="pills-comment-tab" data-toggle="pill" href="#pills-comment">
            <span>酒店点评</span>
        </a>
    </li>
</ul>
<div class="tab-content hotelClass" id="pills-tabContent">
    <div class="tab-pane fade show active" id="pills-catalog">
        <div class="container hot">
            <h6>房型介绍</h6>
            <div id="allTravels" render-loop="list">

                <div class="row detail">
                    <div class="col bigimg">
                        <img width="150px" height="150px" render-src="list.imgUrl">
                    </div>
                    <div class="col">
                        <h4 render-html="list.name"></h4>
                        <br/>
                        <br/>
                        <p>
                            <span render-html="list.location"></span>
                            <br/>
                            <br/>
                            <span render-html="list.typeName">

                    </span>
                            <span class="addr f20" render-html="list.price" style="color: #F44336"></span><span>元</span>
                        </p>
                        <hr/>
                    </div>

                </div>
            </div>
        </div>

    </div>
    <div class="tab-pane fade " id="pills-comment">

        <div class="container tag">
            <h6>骡友标签</h6>
            <div>
                <span>价格便宜</span>
                <span>很热闹</span>
                <span>交通方便</span>
                <span>吃的很多</span>
                <span>风景优美</span>
                <span>美食很多</span>
                <span>很特别</span>
                <span>爱上这座城</span>
                <span>住宿方便</span>
                <span>刚刚</span>
            </div>
        </div>
        <hr>


        <!--评论部分 封印-->
        <div id="comment">
            <div render-loop="list">
                <div class="container row comment">
                    <div class="col-2 comment-head">
                        <a>
                            <img class="rounded-circle" render-src="list.user.headImgUrl">
                        </a>
                    </div>
                    <div class="col comment-right">
                        <p class="authorName"><span render-html="list.user.nickName"></span></p>
                        <p class="releaseTime">评论时间: <span render-html="list.releaseTime"></span></p>


                        <div class="stars">
                            <span class="comment-star" render-attr="data-starid=list.id"> </span>
                            <span class="comment-date" render-html="list.commentTime"></span>
                        </div>


                        <div class="comment-content">
                            <a href="strategyComment.html">
                                <p render-html="list.content"></p>
                            </a>
                        </div>
                        <div class="d-flex icon">
                            <a href="strategyComment.html">
                                <i class="fa  fa-commenting-o " style="margin-right: 10px"> 评论 </i>
                                <i class="fa fa-thumbs-o-up"> <span render-html="list.likes"></span> </i>
                            </a>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>

</div>
</div>

<div class="operation">
    <button class="btn">加入旅行单</button>
    <button class="btn" id="commentBtn">点评</button>
</div>


</body>
</html>